package com.xu.sso.web.service.convert;

import com.xu.sso.core.enums.StatusEnum;
import com.xu.sso.db.model.base.AppRole;
import com.xu.sso.db.model.base.Resources;
import com.xu.sso.web.model.request.AddResourcesRequest;
import com.xu.sso.web.model.request.AddRoleRequest;

public class PowerConvert {

    public static Resources convert(AddResourcesRequest request) {
        Resources resources = new Resources();
        resources.setAppId(request.getAppId());
        resources.setResName(request.getResName());
        resources.setResPath(request.getResPath());
        resources.setResDesc(request.getResDesc());
        resources.setLogin(request.getLogin());
        return resources;
    }

    public static AppRole convert(AddRoleRequest request) {
        AppRole appRole = new AppRole();
        appRole.setAppId(request.getAppId());
        appRole.setRoleName(request.getRoleName());
        appRole.setRoleDesc(request.getRoleDesc());
        appRole.setStatus(StatusEnum.Start.getCode());
        appRole.setRemark(request.getRemark());
        return appRole;
    }

}
